<script>
const app = getApp();
export default {
  name: "com-order-list",
  props: {
    orderList: {
      type: Array,
      default: []
    }
  },
  data() {
    return {
      BestImgUrl: app.globalData.imgurl,
      imgurlBwc: app.globalData.imgurlBwc,

    }
  },
  methods: {
    //获取图片的第一张
    packageimage(data) {
      return data[0]
    },
    //取出两位小数
    toFixedTwo(val) {
      var str = Number(val).toFixed(2)
      return str;
    },
    //  复制笔记链接
    copy_no(url) {
      uni.setClipboardData({
        data: url, // e是你要保存的内容
        success: function () {
          uni.showToast({
            title: '复制成功',
            icon: 'none'
          })
        }
      });
    },
    //笔记要求弹窗
    orderNoteFun(data) {
      // console.log("笔记要求", data)
      this.$emit("noteRequireFun", data)
    },
  }
}
</script>

<template>
  <view>
    <view class="order_list_item" v-for="(item,index) in orderList" :key="index">
      <view class="order_title u-flex">
        <view class="shop_title u-flex" @click="copy_no(item.order_no)">
          <text class="text-Omit">订单号：</text>
          <text class="text-Omit">{{ item.order_no }}</text>
          <image :src="imgurlBwc+'/order/copy@2x.png'" style="margin-left: 10rpx"></image>
        </view>

        <view class="status">
          <!--
            1待付款
            2已付款
            3已核验（等待上传）
            4待审核（已上传）
            5已完成
            -1已取消(超时、自动)
            -2已驳回（审核失败）
            -3已退款（金额原路返回）
          -->

          <text class="color1" v-if="item.status == 2">待使用</text>
          <text class="color1" v-if="item.status == 3">已核销，待上传笔记</text>
          <text class="color2" v-if="item.status == 4">审核中</text>
          <text class="color2" v-if="item.status == 5">已完成</text>
          <text class="color2" v-if="item.status == 6">待返款</text>
          <text class="color1" v-if="item.status == -1">已取消</text>
          <text class="color1" v-if="item.status == -2">已驳回</text>
          <text class="color1" v-if="item.status == -3">已退款</text>
        </view>
      </view>
      <view class="shop-list-item-top" @click="lookBiTc(item)">
        <view class="shop-list-item-img">
          <image :src="packageimage(item.package_images)" mode="aspectFill"></image>
        </view>
        <view class="shop-list-item-right">
          <view class="shop-list-item-title ellipsis-one-line">{{item.package_name}}</view>
          <view class="shop-list-item-subt ellipsis-two-line">{{item.tab_name}}</view>
          <!--<view class="shop-list-item-price">
            <text>活动价：</text>
            <text>￥</text>
            <text style="font-size: 40rpx;font-weight: bold">{{ toFixedTwo(item.price - item.rebate_amount) }}</text>
          </view>-->
        </view>
      </view>
      <view class="shop-list-item-bottom">
        <view class="shop-list-item-bottom-text">
          <text>实付金额</text>
          <text style="color: #FF7900">￥{{ toFixedTwo(item.price) }}</text>
        </view>
        <view class="shop-list-item-bottom-text">
          <text>下单时间</text>
          <text>{{item.create_time}}</text>
        </view>
        <view class="shop-list-item-bottom-text">
          <text>笔记平台</text>
          <text>{{item.platform_type.title}}</text>
        </view>
        <view class="shop-list-item-bottom-text">
          <text style="width: 96rpx">笔记要求</text>
          <text class="nide-text ellipsis-one-line">{{item.activity_ask}}</text>
          <text @click="orderNoteFun(item.activity_ask)" style="color: #888888;position: absolute;right: 0;width: 64rpx">详情></text>
        </view>
        <view v-if="item.verify_time != '0000-00-00 00:00:00'" class="shop-list-item-bottom-text">
          <text>核销时间</text>
          <text>{{item.verify_time}}</text>
        </view>
        <view v-if="item.verify_time != '0000-00-00 00:00:00'" class="shop-list-item-bottom-text">
          <text>核销类型</text>
          <text v-if="item.is_self_verify == 1">自主核销</text>
          <text v-if="item.is_self_verify == 0">扫码核销</text>
        </view>
      </view>

    </view>
    <!-- 笔记要求详情弹窗 -->
    <u-popup v-model="askShow" mode="center" border-radius="14" width="80%">
      <view class="ask-pop">
        <view class="ask-content">{{askData}}</view>
        <view class="ask-btn" @click="askShow = false">
          <text >我知道了</text>
        </view>
      </view>
    </u-popup>
  </view>
</template>

<style scoped lang="scss">
// 笔记要求详情弹窗
.ask-pop{
  padding: 30rpx;
  .ask-content{
    line-height: 50rpx;
  }
  .ask-btn{
    padding: 10rpx 20rpx;
    margin: 20rpx 0;
    font-size: 32rpx;
    color: #FFFFFF;
    background: #FF7900;
    border-radius: 50rpx;
    text-align: center;
  }
}
</style>